import {axios} from '../utils/request'
import {SQUARE_MODULE} from "./_prefix";

export const getSharedFileList = userId => {
    return axios.get(`${SQUARE_MODULE}/sharedFileList`, {
        params: {
            userId: userId
        }
    }).then(res => {
            return res;
        }
    )
}

export const getCollectFileList = userId => {
    return axios.get(`${SQUARE_MODULE}/collectFileList`, {
        params: {
            userId: userId
        }
    }).then(res => {
            return res;
        }
    )
}

export const getSharedModelList = userId => {
    return axios.get(`${SQUARE_MODULE}/sharedModelList`, {
        params: {
            userId: userId
        }
    }).then(res => {
            return res;
        }
    )
}

export const getCollectModelList = userId => {
    return axios.get(`${SQUARE_MODULE}/collectModelList`, {
        params: {
            userId: userId
        }
    }).then(res => {
            return res;
        }
    )
}


export const shareFile = payload => {
    const {userId, fileId} = payload;
    return axios.post(`${SQUARE_MODULE}/shareFile?userId=${userId}&fileId=${fileId}`).then( res => {
        return res;
    });
}

export const shareModel = payload => {
    const {userId, modelId} = payload;
    return axios.post(`${SQUARE_MODULE}/shareModel?userId=${userId}&modelId=${modelId}`).then( res => {
        return res;
    });
}

export const collectFile = payload => {
    const {userId, fileId} = payload;
    return axios.post(`${SQUARE_MODULE}/collectFile?userId=${userId}&fileId=${fileId}`).then( res => {
        return res;
    });
}

export const collectModel = payload => {
    const {userId, modelId} = payload;
    return axios.post(`${SQUARE_MODULE}/collectModel?userId=${userId}&modelId=${modelId}`).then( res => {
        return res;
    });
}

